const http = require('http');
const WebSocket = require('ws');

const server = http.createServer();
const wss = new WebSocket.Server({ server });

wss.on('connection', (ws) => {
  console.log('Backend WebSocket connected');
  ws.send('Connected to Service 1');

  ws.on('message', (message) => {
    console.log('Received:', message.toString());
    ws.send(`Echo: ${message.toString()}`);
  });
});

server.listen(3001, () => {
  console.log('Test Service 1 running on port 3001');
});